<template>
  <div>
    <el-table
        :data="deptinfoList"
        stripe
        style="width: 100%">
      <el-table-column
          prop="deptName"
          label="员工名">
      </el-table-column>
      <el-table-column
          prop="deptBirthday"
          label="生日">
      </el-table-column>
      <el-table-column
          prop="infoJob"
          label="职位">
      </el-table-column>
      <el-table-column
          prop="infoSalary"
          label="薪水">
      </el-table-column>
      <el-table-column
          prop="infoTime"
          label="日期">
      </el-table-column>
    </el-table>


    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="审批人">
        <el-input v-model="formInline.deptId" placeholder="审批人"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "DeptInfo",
  data(){
    return{
      role:'/2',
      deptinfoList:[],
      formInline: {
        deptId:''
      }
    }
  },
  mounted() {
    this.init()
  },
  methods:{
    init(){
      let url = 'api/dept/selectAll'+this.role
      this.$axios.get(url).then(r=>{
        this.deptinfoList=r.data
        console.log(this.deptinfoList)
        if (this.deptinfoList == ''){
          this.$message.warning("你没有权限,哈鸡儿")
        }
        // console.log(r.data)
      })
    },
    onSubmit(){
      let url = 'api/dept/select'+this.role+'/'+this.formInline.deptId
      console.log(url)
      this.$axios.get(url).then(r=>{
        this.deptinfoList=r.data
        console.log(this.deptinfoList)
        if (this.deptinfoList == ''){
          this.$message.warning("你没有权限,哈鸡儿")
        }
        // console.log(r.data)
      })
    }
  }
}
</script>

<style scoped>

</style>